const { Types } = require("mongoose");
const mongoose = require("./db");

let Schema = mongoose.Schema;

// 用户表
let UserSchema = new Schema({
  username: String,
  password: String,
  phone: String,
  face:{
    type:String,
    default:'https://img.axureshop.com/8d/2f/30/8d2f3075c60b454382a8e5b016e47cf6/images/%E4%B8%AA%E4%BA%BA%E4%BF%A1%E6%81%AF%E4%BF%AE%E6%94%B9/u5548.png'
},
  role: {
    type: Types.ObjectId,
    ref: "role",
  },
});

// 角色表

let RoleSchema = new Schema({
  rolename: String,
});


// pc端路由表

let RouterSchema=new Schema({
  routername:String
})



// 用户模型
let UserModel = mongoose.model("user", UserSchema);
// 角色模型
let RoleModel = mongoose.model("role", RoleSchema,'role');
// 路由模型
let RouterModel = mongoose.model("router", RouterSchema);


module.exports ={UserModel,RoleModel,RouterModel}